package cn.com.api.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.com.api.entity.ApiU_bonus;
import cn.com.api.entity.ApiU_bonus_detail;
import cn.com.api.mapper.base.U_bonus_detailMapperBase;
import cn.com.util.PageInfo;

//DAO
public interface ApiU_bonus_detailMapper extends U_bonus_detailMapperBase {

	// 获取可领取的红包
	public ApiU_bonus_detail findBonusItem(@Param("bonus_id") String bonus_id);

	// 新增对象后返回记录ID
	public int U_bonus_detailInsertion(ApiU_bonus_detail u_bonus_detail);

	// 获取转发红包
	public ApiU_bonus_detail getBonus_detailByID(@Param("bonus_detail_id") Integer bonus_detail_id);

	// 取最大红包
	// public Float getMaxBonus(@Param("bonus_id") String bonus_id);

	// 检查是否领取过红包
	public ApiU_bonus_detail checkAvailableBonus(@Param("bonus_id") String bonus_id, @Param("user_id") String user_id);

	// 喊红包中奖列表
	public List<ApiU_bonus_detail> getRollBonusListPage(@Param("type") String type, @Param("page") PageInfo page);

	public void selectForHome(@Param("map") Map map);

	public void insertU_bonus_details(Map map);

	// 检查是否还有金额的红包可领
	public String checkHasMoneyBonus(@Param("bonus_id") String bonus_id);

	// 检查红包可领是否已领完(有金额和无金额已达到总数)
	public Integer checkBonusAvailable(@Param("bonus_id") String bonus_id);
	
	//红包中奖排行
	public List<ApiU_bonus_detail> getBonusHoldListPage(@Param("map") Map map, @Param("page") PageInfo page);
	
	//普通红包中奖记录
	public List<ApiU_bonus_detail> getNormalBonusList(@Param("bonus_id") String bonus_id);
	
	//最佳手气
	public ApiU_bonus_detail getMaxMoneybyBonusId(@Param("bonus_id") String bonus_id);

	public List<ApiU_bonus_detail> getUnclaimedBonusDetail(Integer hours);
	
	//收到的红包记录 头部
	public String getReceiveNormalBonusListHeader(@Param("user_id") String user_id);
	
	//收到的红包记录
	public List<ApiU_bonus_detail> getReceiveNormalBonusListPage(@Param("user_id") String user_id, @Param("page") PageInfo page);
	
	//发出的红包 头部 
	public String getSendNormalBonusListHeader(@Param("user_id") String user_id);
	
}
